package com.cls.common.conf;

import com.aliyuncs.CommonRequest;
import com.aliyuncs.DefaultAcsClient;
import com.aliyuncs.IAcsClient;
import com.aliyuncs.http.MethodType;
import com.aliyuncs.profile.DefaultProfile;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SMSConfig {

    @Value("${accessKey.secret}")
    private String accessKeySecret;
    @Value("${accessKey.id}")
    private String accessKeyId;

    @Value("${SMS.domain}")
    private String domain;

    @Bean
    public IAcsClient getAcsClient() {
        DefaultProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId,
                accessKeySecret);
        return new DefaultAcsClient(profile);
    }


    public CommonRequest getDefaultPostCommonRequest() {
        CommonRequest request = new CommonRequest();
        request.setSysMethod(MethodType.POST);
        request.setSysDomain(domain);
        request.setSysVersion("2017-05-25");
        request.putQueryParameter("RegionId", "cn-hangzhou");
        return request;
    }


}
